package demo2;

/**
 * @Author liangzai
 * @Description:
 */
//public class Student {
//    private String name;
//    private int age ;
//
//    public void Student(){}
//
//    public Student(String name) {
//        this.name = name;
//    }
//
//    public Student(int age) {
//        this.age = age;
//    }
//
//    public Student(String name, int age) {
//        this.name = name;
//        this.age = age;
//    }
//
////    public void speak(){
////        System.out.println("我爱学习");
////    }
//}


class Caculator {
    public double getArea(double a){
        return a*a;
    }
    // ---------------------Begin------------------------
    public double getArea(double a,double b){
        return a*b;
    }

    public double getArea(double a,double b,double c){
        return a*b*c;
    }

    // ---------------------End------------------------

}


public class Student {

    private int age;
    private String name;
    private String sex;
    // ---------------------Begin------------------------

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if(age>=0 && age<=120){
            this.age = age;
        }else this.age = 18;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        if(sex.equals("男") || sex.equals("女")) this.sex = sex;
        else this.sex = "保密";
    }


    // ---------------------End------------------------


    @Override
    public String toString() {
        return String.format("大家好，我叫：%s,性别：%s，今年：%d", this.name, this.sex,this.age);
    }
}

class StaticLearning {
    // ---------------------Begin------------------------
    static {
        System.out.println("类静态代码块被调用");
    }

    public static void sayHello(){
        System.out.println("静态方法被调用");
    }

    public static String name="张三";
    // ---------------------End------------------------
}
